/**
 * 上传相关接口
 */

import apiHelper from './apiHelper';

class UploadService {

    uploadImg(data) {
        let url = (window.location.href.indexOf('annualcheck.cx580.com/') > -1 || window.location.href.indexOf('pre.cx580.com') > -1) ? 'https://pic.cx580.com:2443/api/upload' : 'http://192.168.1.50:9016/api/upload';
        let requestParam = {
            url: url,
            data: {
                method: 'post',
                body: data
            }
        };
        return apiHelper.fetch(requestParam);
    }

    //获取
    getUploadResult(data) {
        let requestParam = {
            url: `${apiHelper.baseApiUrl}inspection/viewRequirements`,
            data: {
                method: 'get',
                body: data
            }
        };
        return apiHelper.fetch(requestParam);
    }

}

// 实例化后再导出
export default new UploadService()